UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pc3ELZNReFrse3Ij8SfaFPl4zmQ1XBCDWwc5SrDOA2I=' 
WHERE 
  key_id = 'ed7269ae460b9f5d93a6661bbab26a101edce0d201eccf82c9b67e9c29f4e08a' 
  AND (
    token = 'Pc3ELZNReFrse3Ij8SfaFPl4zmQ1XBCDWwc5SrDOA2I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032