UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WZd29d+sz2ZP0fgj4QOAjYYfhP53Uja8Dzu5RvygdkU='
WHERE
key_id = 'a9c7ebc53720de2ef2735f25f636b26f615081f34eed0fdc48563427627f48bf'
AND (
token = 'WZd29d+sz2ZP0fgj4QOAjYYfhP53Uja8Dzu5RvygdkU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)