UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AVS5/i3tzpn2Ik2NbppBNKy/u15/apXVmEGBHLO1QNw='
WHERE
key_id = 'd45c8313b1ed1399b15c3b62cb7d26b242db41906d14c5e03a328759cc2252cd'
AND (
token = 'AVS5/i3tzpn2Ik2NbppBNKy/u15/apXVmEGBHLO1QNw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)