UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1iYTqIWniDc+v2tykFZMzTL1NkgUJrWYJzAvbKUrVXY='
WHERE
key_id = 'c838d9d3b075f3965f9ec7be534608eff66cb2edb8a105b23d1dccead5de36eb'
AND (
token = '1iYTqIWniDc+v2tykFZMzTL1NkgUJrWYJzAvbKUrVXY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)