UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yG5v0ppgaAG7WnlKqX9+He4yqxBGi2JC8OmUhbobiak='
WHERE
key_id = '5d9cc971e67ef9252b45120b9bc26c3d92403f2a7f0a083a1b5ec0576a3d5839'
AND (
token = 'yG5v0ppgaAG7WnlKqX9+He4yqxBGi2JC8OmUhbobiak='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)