UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'spFld+FobapmHr2//1Iz6wPr0+rkfq2SQyTRYoa8oS0=' 
WHERE 
  key_id = '3982aa1e90fd5431c5fc3d681e7789b03748083fce239118bdfd540190c9b626' 
  AND (
    token = 'spFld+FobapmHr2//1Iz6wPr0+rkfq2SQyTRYoa8oS0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028