UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gTDygz0oE91i88BjfdTt2izxVW68V8VOJeo5NK0OXHM=' 
WHERE 
  key_id = '78e197c2eeed36a3050e26cf27a84836f7af01cc4b52585b500c63f26530757f' 
  AND (
    token = 'gTDygz0oE91i88BjfdTt2izxVW68V8VOJeo5NK0OXHM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021