UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7+jI1SKa1HxoJulc8fKk8mQCzRciB2fTXnp3/HD5uvg='
WHERE
key_id = '4a97f4fc2d6b019c50a34b4d999f35c4e2df77102a86a5af3cefc07808a34230'
AND (
token = '7+jI1SKa1HxoJulc8fKk8mQCzRciB2fTXnp3/HD5uvg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)