UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Wgcy+x+GH+rQzArP5F0hVGmCYdugayMDuVpTZ7V41As='
WHERE
key_id = 'dbda6f2bd1ebaa0f284fdddda9700184adb90bcf65359704d802c88b563e1345'
AND (
token = 'Wgcy+x+GH+rQzArP5F0hVGmCYdugayMDuVpTZ7V41As='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)