UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oVv+QKTJ8euSAFPMvKmygBnALuBzEf9uq6hlC+4df4I=' 
WHERE 
  key_id = '9f7b92e40cfff44d3fbb6507ea36129fff6348ffdc979d87060b75adb781977e' 
  AND (
    token = 'oVv+QKTJ8euSAFPMvKmygBnALuBzEf9uq6hlC+4df4I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039