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

Query time 0.00036