UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yV2o/V0QpABM06Xy22L/PJg7mA+IUWBngyHoIncdu1o=' 
WHERE 
  key_id = '1cddc9b66645e21ec0752b7e06a668099e6245c6e27944edbbda53598ea0da7a' 
  AND (
    token = 'yV2o/V0QpABM06Xy22L/PJg7mA+IUWBngyHoIncdu1o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034