UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b2SOAmR1+XrbvUSam7RiCibuOKgGz/5JiTdH8e8VSS8=' 
WHERE 
  key_id = 'bd58eff8108f326841e3b430b346324b00fc4b2bc992baeb356b360517b85dae' 
  AND (
    token = 'b2SOAmR1+XrbvUSam7RiCibuOKgGz/5JiTdH8e8VSS8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042