UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9mr4XflXPctZFs9WKBKNyVeZ09+cbJQ+rTDso+W5XPY='
WHERE
key_id = '02b4e8d058b8c60697054f9bc302573ca2f06b23276749539acddb6da635db9b'
AND (
token = '9mr4XflXPctZFs9WKBKNyVeZ09+cbJQ+rTDso+W5XPY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)