UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hiQsmT2k4bbp2iuWxz1czxVdx4SIgh9ghObdGhNUTc0=' 
WHERE 
  key_id = '3d40990229fa5e75a0b7aff63500753e2d1b84e1a92798b81858a89ca71c5901' 
  AND (
    token = 'hiQsmT2k4bbp2iuWxz1czxVdx4SIgh9ghObdGhNUTc0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050