UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JWe70nZpKkO4UQ1+cEVDJi+PXEKDdESqn69/POd+z5c='
WHERE
key_id = '87a2fe6e7e62d77377f60549d02c57a9d15a1cd514c62d42e632142b7513d6cf'
AND (
token = 'JWe70nZpKkO4UQ1+cEVDJi+PXEKDdESqn69/POd+z5c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)