UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+D0ukCUBXrrnyuuZ26rvyddGjzrcoJAfCqt10+7HnIk='
WHERE
key_id = '3431f98ae92ecb7705c639cdeee20e9fa66d66ab989f0a86d1a904d8533a496c'
AND (
token = '+D0ukCUBXrrnyuuZ26rvyddGjzrcoJAfCqt10+7HnIk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)