UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+1G3IOJcLNp6jwTbIr9YrTHU7vcFLXHY9MvariqWuTg='
WHERE
key_id = '4005ced1d9e83a66b335062253129ed164d46a502bb8e256de2e5670e37544f3'
AND (
token = '+1G3IOJcLNp6jwTbIr9YrTHU7vcFLXHY9MvariqWuTg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)