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

Query time 0.00019