UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IB2rpzTZHeKNYKbmRkp2WUj6vd0WxMAWajFSCVHDggg='
WHERE
key_id = 'c302051b04a62408cd94e860471f7b99dcf2c0d792f8775d75ead9eb0b31cf02'
AND (
token = 'IB2rpzTZHeKNYKbmRkp2WUj6vd0WxMAWajFSCVHDggg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)