UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7Z9I8AiwhncfnTNSNUvie2m5OCNySRQ/QuDuRpJOLHs=' 
WHERE 
  key_id = '50a25c36c403d5cafe21bfb5d2bd7cab27fc3a45e0e08a0673646abcd7d08651' 
  AND (
    token = '7Z9I8AiwhncfnTNSNUvie2m5OCNySRQ/QuDuRpJOLHs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044