UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cK1oe+U2Mx5INP58ySpaLmJcBaddqReFPdJ9d8Ey0kk=' 
WHERE 
  key_id = 'eb6796547689db55d822056649a790458b2bee2d78c95dcf3e416f364d1713a1' 
  AND (
    token = 'cK1oe+U2Mx5INP58ySpaLmJcBaddqReFPdJ9d8Ey0kk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020