UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZeVA6O2nhoV0iRes+uSngc+tw0odwuMKfWUrAdJ5VVM='
WHERE
key_id = 'fe61f9b3e4cfe1101782a0ce0e8b1e5350cf8e49bfcff64fb4d3d6e91b1aca73'
AND (
token = 'ZeVA6O2nhoV0iRes+uSngc+tw0odwuMKfWUrAdJ5VVM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)