UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q9bb7zlw+Tc7QlYUSXlBp2+WXcUDDND3cN0Usr3Xr5w='
WHERE
key_id = '1a030ea117f42a731af50fa28f33d4db6d8baa63c0b68871fc6723905a4a0669'
AND (
token = 'Q9bb7zlw+Tc7QlYUSXlBp2+WXcUDDND3cN0Usr3Xr5w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)