UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AiNoPpc9dT+MQbdiCQz2BjfWk6q+Po+6msNI2DW7S1U='
WHERE
key_id = '9afea939890f427eb9a2e36489e7e026fc918c4c339ebf327bbbccdeba4d58ae'
AND (
token = 'AiNoPpc9dT+MQbdiCQz2BjfWk6q+Po+6msNI2DW7S1U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)