UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iUAkG7NwD2VcKWC+Qlpo3hX6pxBdzKBAyj3ewZe3oVI=' 
WHERE 
  key_id = 'ff0bcd73510491c42c4cd1463c7505915f6a4fcd4fff4d44adf67009b2496984' 
  AND (
    token = 'iUAkG7NwD2VcKWC+Qlpo3hX6pxBdzKBAyj3ewZe3oVI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028