UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4NivSX5pUn+mcLpJSaQRsO66yx09AEinJ+Nc6inzhME=' 
WHERE 
  key_id = 'd45ea08c0287fb409c944bc7008b35fb06d5b656f1208c54dd8354eced211088' 
  AND (
    token = '4NivSX5pUn+mcLpJSaQRsO66yx09AEinJ+Nc6inzhME=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033