UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cg+dvzh8WXFUh393rSX/lUJSeJj/B6wHctyHFK97BOs='
WHERE
key_id = '1234ed50529e81fd335b35a7682f936193b46ed555f5939b9d5825d8d2b9ff4a'
AND (
token = 'cg+dvzh8WXFUh393rSX/lUJSeJj/B6wHctyHFK97BOs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)