UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y3+jsFSMb5UMRECHhUUzGiwQ3YEWCifk8lOnBb/YYOU=' 
WHERE 
  key_id = 'c9068fd4c5b40df278a88519df06050693a3dbf0e88ec676782fb1b04ebc26e2' 
  AND (
    token = 'Y3+jsFSMb5UMRECHhUUzGiwQ3YEWCifk8lOnBb/YYOU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026