UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ExuhC+NlpTgVUQefkNCn32iVJq51CCtgpq6zp/4SHxI='
WHERE
key_id = '47b40198738e4fe1889175b21e89ccae02a5491563d1c323246ced1b28dc900e'
AND (
token = 'ExuhC+NlpTgVUQefkNCn32iVJq51CCtgpq6zp/4SHxI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)