UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8vfhwPPZ/0gIAJiQtV3TO/vLntLUIkvTJqZLzjmL1QM='
WHERE
key_id = 'd9dde5c626f198e57fe4415f4c6175a345d1e81a16f7a8ecd2b18146f5c24533'
AND (
token = '8vfhwPPZ/0gIAJiQtV3TO/vLntLUIkvTJqZLzjmL1QM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)