UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w5X6pdnpcq1ClKSpGCEe7js54elqpuSH7DjbO+U1Rgc=' 
WHERE 
  key_id = '348b0067e57ffbe3b7552a31f9adee71311359520cb232d558fc7121e044dbef' 
  AND (
    token = 'w5X6pdnpcq1ClKSpGCEe7js54elqpuSH7DjbO+U1Rgc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022