UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sonWEfUHJ+iIyKoIDhfr1uPqF7OvzGuansx/UOwq2Do=' 
WHERE 
  key_id = '43c89013ac08cfdf91cce59e43a6365c95f60e8c644e7a440460f09477697d35' 
  AND (
    token = 'sonWEfUHJ+iIyKoIDhfr1uPqF7OvzGuansx/UOwq2Do=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036