UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TmiyDH3s/DmP4jr3F3tRg2xds2D0GizOFIgr2pDA4nc='
WHERE
key_id = 'f9e93f509418c9c2369e017a549645d066b4d1e9b2a462e4651f9d512aa1aeb2'
AND (
token = 'TmiyDH3s/DmP4jr3F3tRg2xds2D0GizOFIgr2pDA4nc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)