UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HgXEfJ/kNBVIHjIou5Fw0Kg/kfuG0pWC2ZIoeBmwaQc=' 
WHERE 
  key_id = '65000a04cd618902f2c05fe38cfb0c7d942849069edd3385612d4e18daaaa923' 
  AND (
    token = 'HgXEfJ/kNBVIHjIou5Fw0Kg/kfuG0pWC2ZIoeBmwaQc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026