UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'V6sqXtWVaMVl41czID6+0HWGNkFyEUVdjXo2Gi1ZtS4='
WHERE
key_id = 'd50484702829ec98d3f613471379c3ce0e18b41e385e05a6672a25705eafb969'
AND (
token = 'V6sqXtWVaMVl41czID6+0HWGNkFyEUVdjXo2Gi1ZtS4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)