UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'srYwAQHD0mp7cFy7GQGG/2JeDjUiEAgfZoTRnvX9vGY='
WHERE
key_id = 'cb5e9a4b1f7c1855acb1f2395f768d3dc834dbb092d44017487ce4054ec48ef6'
AND (
token = 'srYwAQHD0mp7cFy7GQGG/2JeDjUiEAgfZoTRnvX9vGY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)