UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'trCoDXPaqI3YHoPr7jlDCLCyG1Sw83UGe/+FfQT8ixI=' 
WHERE 
  key_id = '14ddc336f9bffb48f99812486a4bf7f4c76361e7a733ef9053cfc8b03f4830d4' 
  AND (
    token = 'trCoDXPaqI3YHoPr7jlDCLCyG1Sw83UGe/+FfQT8ixI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023