UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C8Dv2eFHkR6nVYGDrZIejNeKJpnsBPv1LB8Y90SxjKI=' 
WHERE 
  key_id = '7f085e985c193d092975ec6c88e42352b6feea478681bee7722fd0661f532d97' 
  AND (
    token = 'C8Dv2eFHkR6nVYGDrZIejNeKJpnsBPv1LB8Y90SxjKI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064