UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'giRPrdk+yxKdWAl9z/yvRGfmNQH+USokLiIwNawuwQw='
WHERE
key_id = '342b3318bf59a650fb035ee1e9f2bed828a91abced1a6a784936e75d87e348fa'
AND (
token = 'giRPrdk+yxKdWAl9z/yvRGfmNQH+USokLiIwNawuwQw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)