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