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

Query time 0.00028