UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kiShny66PfrcW+2uB20KhrB3Yv30CYb9Reywuj6ntOs='
WHERE
key_id = 'bb5af5a42de2525aa95bc9170286e49fc488005df3c4f2e0cfe504f51aabb294'
AND (
token = 'kiShny66PfrcW+2uB20KhrB3Yv30CYb9Reywuj6ntOs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)