UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y8pPwnLc6L+6e7TckbaA9KbG/GMTNGB+ZKXhaSz2uvs=' 
WHERE 
  key_id = 'db631d6f063fee7e3a80f52db1bf3c840bab67ea63b87905bee23e9cee3840f2' 
  AND (
    token = 'y8pPwnLc6L+6e7TckbaA9KbG/GMTNGB+ZKXhaSz2uvs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051