UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wFJqhT26jCbtWK+UrBX9+NEUg++UqNhXNaKLG9vu1g4='
WHERE
key_id = '605742a7fcb9e0fc965bee06b09a5ad97010c671aaea91bc8dd6225ae631d21e'
AND (
token = 'wFJqhT26jCbtWK+UrBX9+NEUg++UqNhXNaKLG9vu1g4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)