UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RpPgwgFWMY2F4isKYeDQwgbbnwNf3nlCbt1FzLoE99M='
WHERE
key_id = '99a1f037ad1b85b48c549aa521f24e9eb57254c075e963c0c247918e637f7275'
AND (
token = 'RpPgwgFWMY2F4isKYeDQwgbbnwNf3nlCbt1FzLoE99M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)