UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6Kfoj3aqSHilNwoPc9/cRCEI8+toeLxMAYrmxv2+Koo='
WHERE
key_id = '783f99f99223bcfe837cbc6223797381cd0973dcfb7a4653167a3e81d97b77ba'
AND (
token = '6Kfoj3aqSHilNwoPc9/cRCEI8+toeLxMAYrmxv2+Koo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)