UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wX1/45oNKDN7lHJQXavkiOGah5COCNcKv5SPu1DR5Rg='
WHERE
key_id = 'c6b39e1e24f8bba344db7fa7775893d3dbc7e11bc68fd9c0fc688dd77f84cb31'
AND (
token = 'wX1/45oNKDN7lHJQXavkiOGah5COCNcKv5SPu1DR5Rg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)