UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bKJMBu3fl/YEDdttxolALcozKxd+4w5bkX9pRWkEBgk=' 
WHERE 
  key_id = '691818da1e69bc019b5c4579fa41c1cbf1828be440b5e55b6ed2d9cb2386927b' 
  AND (
    token = 'bKJMBu3fl/YEDdttxolALcozKxd+4w5bkX9pRWkEBgk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030