UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BIkbIBfTYde8Va+DmxfXjXAJVzkpJJ0de+vcgxaEUAc='
WHERE
key_id = 'd7868089771dbfd185bd0928d8fb2d6bd5d93874dfb385d527961a585b894652'
AND (
token = 'BIkbIBfTYde8Va+DmxfXjXAJVzkpJJ0de+vcgxaEUAc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)