UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5HRc8Y9dw7XmiD1GliygiNkegtOJZkrCYraZdc0uivM='
WHERE
key_id = '974a3a89b782a22342ae7fb52d905138e4869620e9dfb076e5b148e341c544f3'
AND (
token = '5HRc8Y9dw7XmiD1GliygiNkegtOJZkrCYraZdc0uivM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)