UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fAf9ZAUYTRqDMcturSdnz9+0T4jV9bW2gLgOoqT4eFc=' 
WHERE 
  key_id = 'd96a64fc785f10215d704fb3c4ac641ab412c4efc597b3cf86d2ac265bcf0477' 
  AND (
    token = 'fAf9ZAUYTRqDMcturSdnz9+0T4jV9bW2gLgOoqT4eFc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039