UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S5gUHSTBYhRzh+N+REpsdAMdGqWsqe3JBW6xSrN8raI='
WHERE
key_id = 'e38f2f987eba270cd1bed882c419acf77e818e367248b348e506271579218ac0'
AND (
token = 'S5gUHSTBYhRzh+N+REpsdAMdGqWsqe3JBW6xSrN8raI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)